﻿using System.Runtime.Serialization;
using System.Windows.Media;
using System.Windows.Media.Media3D;

namespace GameBoard
{
    [DataContract]
    internal class CubeVisualData : BaseTerrainData
    {
        [DataMember]
        public double Angle { get; set; }

        [DataMember]
        public double Height { get; set; }

        [DataMember]
        public double Width { get; set; }

        [DataMember]
        public double Length { get; set; }

        [DataMember]
        public Point3D Center { get; set; }

        public RotateTransform3D Transform
        {
            get
            {
                var newTransform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), Angle), Center);
                return newTransform;
            }
        }

        public override Point3D CenterOfTerrainFeature
        {
            get
            {
                return Center;
            }
        }
        public override string ItemDescription
        {
            get
            {
                return "Cube";
            }
        }
        public override double ZoomHeight
        {
            get 
            {
                if (Height >= Width && Length >= Length)
                {
                    return Height*2;
                }
                if (Length >= Width && Height >= Length)
                {
                    return Length*2;
                }
                //if (Width >= Length && Height >= Length)
                //{
                    return Width*2;
                //}
            }
        }

        
    }
}